-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fast view snapshotting & improved UX #49
base: master
Are you sure you want to change the base?
Conversation
ProblemThere is one more issue I see. It's about initializing the main views (album, camera and video ones). Initialization happens in Possible solutionI'd suggest to go for something like this: private var appeared = false
public override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if !appeared {
albumView.frame = CGRect(origin: CGPointZero, size: photoLibraryViewerContainer.frame.size)
albumView.layoutIfNeeded()
cameraView.frame = CGRect(origin: CGPointZero, size: cameraShotContainer.frame.size)
cameraView.layoutIfNeeded()
videoView.frame = CGRect(origin: CGPointZero, size: videoShotContainer.frame.size)
videoView.layoutIfNeeded()
NSOperationQueue.mainQueue().addOperationWithBlock { [weak self] in
self?.albumView.initialize()
self?.cameraView.initialize()
self?.videoView.initialize()
}
}
}
override public func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
appeared = true
} It should work since Fusuma supports only portrait orientation (please correct me if I'm wrong). Some thoughtsAlso it's not that difficult to notice the method taking the majority of initialization time. It's
We can use Instruments to get more accurate picture but... There is something to do with fetching stuff. Maybe it's better to fetch some minimum count of images just for initialization purpose and then fetch others. What do you think about it? |
@mozharovsky I totally agree with you. Could you add those solutions to this pull request? |
Fast view snapshotting & improved UX ytakzk#49
Any updates on this? |
@mozharovsky New maintainer here. Is this PR still relevant? |
Not sure how to reconcile this into the current codebase, since we now have multiple callbacks. Could you update to |
Small but useful changes
iOS 7 brought a much faster way to draw the view's hierarchy into the context. Instead of rendering the layer in the context you simply call
drawViewHierarchyInRect(_:, _:)
method on your view which does all the magic. It's really cool! 😎Using
viewWillDisappear()
method isn't quite well for user experience – stopping sessions takes time, as a result we get a delay which is noticeable enough. Such things don't make users happy, so let's change the point. 😃Thanks in advance!